//
// Created by Jisam on 2024/7/19.
//
#include <bits/stdc++.h>

#define PSI pair<string,int>
#define PII pair<int,int>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define i64 long long

using namespace std;

const int N = 1e5 + 5;
int ans;

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    int yes = 1;
    int cnt = 0;
    int t;
    for (int i = 0; i < m; i++) {
        int j;
        map<int,int> mp;
        for (j = 0; j < n; j++) {
            cin >> t;
            mp[t] ++;
        }
        int cnt1 = 0,cnt2 = 0;
        for(auto x : mp){
            if (x.first == k){
                cnt1 += x.second;
            }else{
                cnt2 += x.second;
            }
        }
        if(cnt1 >= cnt2) {
            cnt ++;
        }
    }
    if (cnt * 2 >= m) { cout << "YES"; }
    else cout << "NO";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}